#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "RegionGrowing.h"
#include "Convolution.h"
#include <QStack>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void setOriginalImage(QImage * img);
    void setSegmentedImage(QImage * img);
    void resizeTable(int dim);

protected:
    void changeEvent(QEvent *e);
    void mousePressEvent(QMouseEvent * event);

private:
    Ui::MainWindow *ui;

    // image to segment
    QImage * img;

    // auxiliar image
    QImage * auxImg;

    QImage * segmImg;

    // seeds list
    QList<QPoint> seeds;

    // convolution matrix
    Convolution * cnv;

    // default dimension
    int defDim;

    // decides whether to capture the mouse click on the image
    bool captureClick;

    // variables used to save the results of applying the algorithms
    RegionGrowing * rAlg;
    Segmentation * segm;

    // the segmented image color
    QColor segmColor;

    QStack<QImage> * undo;


private slots:
    void on_actionExportar_triggered();
    void on_btnUndo_clicked();
    void on_btnReset_clicked();
    void on_comboBox_currentIndexChanged(int);
    void on_btnColor_clicked();
    void on_pushButton_clicked();
    void on_pushButton_2_clicked();
    void on_actionSalir_triggered();
    void on_actionAbrir_triggered();
    void on_btnApplyConv_clicked();
    void on_spnOrderConv_valueChanged(int);
};

#endif // MAINWINDOW_H
